package com.example.demo.dao;

import com.example.demo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @author zhangs
 * @version v1.0
 * @decription
 * @date 2021/4/6 23:41
 **/
public interface UserDao extends JpaRepository<User, Long> {
    @Query("update #{#entityName} t set t.password = :password where t.id = :id")
    @Modifying
    int updatePassword(@Param("id") Long id, @Param("password") String password);
}
